package com.wteam.framework.modules.member.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.wteam.framework.modules.member.entity.dos.Member;
import com.wteam.framework.modules.member.entity.entity.SdMember;
import com.wteam.framework.modules.member.entity.vo.MemberVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 会员数据处理层
 *
 * @author Bulbasaur
 * @since 2020-02-25 14:10:16
 */
public interface MemberMapper extends BaseMapper<Member> {

    /**
     * 获取所有的会员手机号
     * @return 会员手机号
     */
    @Select("select m.mobile from wteam_member m")
    List<String> getAllMemberMobile();

    @Select("select * from wteam_member ${ew.customSqlSegment}")
    IPage<MemberVO> pageByMemberVO(IPage<MemberVO> page, @Param(Constants.WRAPPER) Wrapper<Member> queryWrapper);

    @Select("SELECT * FROM sd_member WHERE phone_number = #{phoneNumber}")
    SdMember selectOne(LambdaQueryWrapper<SdMember> queryWrapper);
}